package com.core.model.enumType;

import com.core.dto.ForEnumDTO;
import org.apache.commons.collections.map.HashedMap;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: lxf
 * Date: 2017/2/23
 * Time: 10:53
 * To change this template use Editor | File and Code Templates.
 */
public enum WorkOverTimeEnum {

    UPGRADESUPPORT("升级支撑"),
    COMMONWORK("普通加班");

    private String label;

    WorkOverTimeEnum(String label) {
        this.label = label;
    }

    public static List<ForEnumDTO> toDTOs() {
        List<ForEnumDTO> forEnumDTOs = new ArrayList<>();
        for (WorkOverTimeEnum workOverTimeEnum : WorkOverTimeEnum.values()) {
            String value = workOverTimeEnum.name();
            String label = workOverTimeEnum.getLabel();
            forEnumDTOs.add(new ForEnumDTO(value, label));
        }
        return forEnumDTOs;
    }

    public static Map<String, Object> toMaps() {
        Map<String, Object> map = new HashedMap();
        for (WorkOverTimeEnum workOverTimeEnum : WorkOverTimeEnum.values()) {
            map.put(workOverTimeEnum.name(), workOverTimeEnum.getLabel());
        }
        return map;
    }


    public String getLabel() {
        return label;
    }

    public String getValue() {
        return name();
    }
}
